<template>
  <view>
    <view class="w100 h-444 absolute" style="background: linear-gradient(to bottom,#BAD8FF,#F7F7F7);"></view>
    <uni-status-bar></uni-status-bar>
    <view class="w100 rowscl pt-24 rowsm mb-20" @click="$tools.goNext('/pagesCopy/user/userInfo')">
      <image :src="userInfo.avatar" class="w-118 h-118 br-59 mb-20" style="border: 2rpx solid #487EFF;" mode=""></image>
      <view class="fs-36 col333 fw-b mb-10">{{userInfo.name}}</view>
      <view class="fs-28 col666">{{userInfo.jsNumber}}</view>
    </view>
    
    <view class="w100 relative pl-24 pr-24">
      <view class="w100 pl-24 pt-24 pr-24 bgff br-16" style="box-shadow: 0 0 6rpx 2rpx rgba(212, 212, 212, .11);">
        <view class="fs-32 col000 fw-b">服务</view>
        <view class="w100 h-120 rowsb rowsm" style="border-bottom: 2rpx solid rgba(112,112,112,.1);" @click="$tools.goNext('/pagesCopy/user/userInfo')">
          <view class="rows rowsm">
            <image src="/static/icon_35grxx.png" class="w-40 h-40 mr-20" mode=""></image>
            <view class="fs-26 col666">个人信息</view>
          </view>
          <image src="/static/icon_21jt.png" class="w-24 h-24" mode=""></image>
        </view>
        <view class="w100 h-120 rowsb rowsm" style="border-bottom: 2rpx solid rgba(112,112,112,.1);" @click="$tools.goNext('/pagesCopy/user/useInfo')">
          <view class="rows rowsm">
            <image src="/static/icon_35sybz.png" class="w-40 h-40 mr-20" mode=""></image>
            <view class="fs-26 col666">使用帮助</view>
          </view>
          <image src="/static/icon_21jt.png" class="w-24 h-24" mode=""></image>
        </view>
        <view class="w100 h-120 rowsb rowsm" style="border-bottom: 2rpx solid rgba(112,112,112,.1);" @click="$tools.goNext('/pagesCopy/user/changePwd')">
          <view class="rows rowsm">
            <image src="/static/icon_35xgmm.png" class="w-40 h-40 mr-20" mode=""></image>
            <view class="fs-26 col666">修改密码</view>
          </view>
          <image src="/static/icon_21jt.png" class="w-24 h-24" mode=""></image>
        </view>
       <view class="w100 h-120 rowsb rowsm" style="border-bottom: 2rpx solid rgba(112,112,112,.1);" @click="unbindBtn()">
          <view class="rows rowsm">
            <image src="/static/icon_35wxbd.png" class="w-40 h-40 mr-20" mode=""></image>
            <view class="fs-26 col666">微信解绑</view>
          </view>
          <image src="/static/icon_21jt.png" class="w-24 h-24" mode=""></image>
        </view>
        <view class="w100 h-120 rowsb rowsm" style="border-bottom: 2rpx solid rgba(112,112,112,.1);" @click="$tools.goNext('/pagesCopy/user/agreement?index=1')">
          <view class="rows rowsm">
            <image src="/static/icon_35yhxy.png" class="w-40 h-40 mr-20" mode=""></image>
            <view class="fs-26 col666">用户协议</view>
          </view>
          <image src="/static/icon_21jt.png" class="w-24 h-24" mode=""></image>
        </view>
        <view class="w100 h-120 rowsb rowsm" style="border-bottom: 2rpx solid rgba(112,112,112,.1);" @click="$tools.goNext('/pagesCopy/user/agreement?index=2')">
          <view class="rows rowsm">
            <image src="/static/icon_35ysxy.png" class="w-40 h-40 mr-20" mode=""></image>
            <view class="fs-26 col666">隐私政策</view>
          </view>
          <image src="/static/icon_21jt.png" class="w-24 h-24" mode=""></image>
        </view>
        <view class="w100 h-120 rowsb rowsm" style="border-bottom: 2rpx solid rgba(112,112,112,.1);" @click="outLogin()">
          <view class="rows rowsm">
            <image src="/static/icon_35gysjxt.png" class="w-40 h-40 mr-20" mode=""></image>
            <view class="fs-26 col666">退出登录</view>
          </view>
          <image src="/static/icon_21jt.png" class="w-24 h-24" mode=""></image>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
  export default {
    data() {
      return {
        userInfo:{}
      };
    },
    onShow() {
      this.getUserInfo()
    },
    methods:{
      outLogin(){
        uni.showModal({
          title:'提示',
          content:'确认退出登录吗？',
          success: (res) => {
            if(res.confirm){
              uni.clearStorageSync()
              uni.reLaunch({
                url:'/pages/login/login'
              })
            }
          }
        })
      },
      unbindBtn() {
        uni.showModal({
          title: '提示',
          content: '确认解绑当前手机号吗？',
          success: (res) => {
            if (res.confirm) {
              this.$tools.axiosFromToken('POST', 'prouserter/relieveBinding', {}, '加载中').then(res => {
                if (res.code != 200) return this.$tools.showtt(res.msg);
                setTimeout(() => { this.$tools.showtt(res.msg); }, 0)
                uni.clearStorageSync()
                uni.reLaunch({
                  url: '/pages/login/login'
                })
              })
            }
          }
        })
      },
      getUserInfo(){
        this.$tools.axiosFromToken('POST','prouserter/getById',{},'加载中').then(res => {
          if(res.code != 200) return this.$tools.showtt(res.msg)
          let {data} = res
          data.avatar = this.$tools.avatarUrl + data.avatar
          this.userInfo = data
          
        })
      }
    }
  }
</script>

<style lang="scss">

</style>
